﻿using System;
using Newtonsoft.Json;

namespace LunchCommand.ViewModels
{
    public class LunchStatusViewModel
    {
        public LunchStatus Status { get; set; }

        public String StatusText
        {
            get
            {
                switch (this.Status)
                {
                    case LunchStatus.DidNotHappen:
                        return "There was no lunch today";
                    case LunchStatus.StartedWithConsensus:
                        return "Lunch has been decided!";
                    case LunchStatus.StartedWithoutConsensus:
                        return "Lunch has been decided without full consensus:";
                    case LunchStatus.NotStarted:
                        return "Lunch has not been decided yet";
                    default:
                        return "";
                }
            }
        }

        public Int32? MinutesToTravel { get; set; }

        public VenueConsensusViewModel DecidedVenue { get; set; }

        public VenueConsensusViewModel QuickVenue { get; set; }

        public VenueConsensusViewModel DissentingVenue { get; set; }

        [JsonIgnore]
        public TimeSpan? TimeLeft { get; set; }

        public String TimeRemaining
        {
            get
            {
                if (this.TimeLeft == null)
                {
                    return null;
                }

                return String.Format("{0:0}:{1:00}", this.TimeLeft.Value.Hours, this.TimeLeft.Value.Minutes);
            }
        }
    }
}